package com.briup.oagg.dataset.web.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.briup.framework.utils.web.Response;
import com.briup.oagg.dataset.bean.basic.Indicator;
import com.briup.oagg.dataset.service.IIndicatorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 指标信息业务前端控制器
 *
 * @author briup
 */
@Api(tags = "7.指标管理")
@RestController
@RequestMapping("/indicator")
@Validated
public class IndicatorController {

    @Autowired
    private IIndicatorService service;

    @ApiOperation(value = "分页多条件查询数据集包含的指标名", notes = "根据数据集id分页查询数据集中对应的指标信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "当前页码",defaultValue = "1",required = true,dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "pageSize", value = "每页大小",defaultValue = "5",required = true,dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "datasetId", value = "数据集编号"),
    })
    @GetMapping("/page")
    public Response<Page<Indicator>> findByPage(@RequestParam String datasetId, @RequestParam Integer pageNum, @RequestParam Integer pageSize) {
        Page<Indicator> page = service.findByPage(datasetId,pageNum,pageSize);
        return Response.success(page);
    }
}
